// 自定义变量
@bg-blue-light: #e3f2fd;

// 主容器
.learn {
  max-width: 1400px;
  margin: 15px auto 0;
  padding: 0 20px;
}

// 页面头部
.page-header {
  text-align: center;
  margin-bottom: 40px;

  h1 {
    font-size: 2.5rem;
    color: @text-primary;
    margin-bottom: 8px;
  }

  p {
    font-size: 1.1rem;
    color: @text-secondary;
  }
}

// 学习内容区域
.learning-content {
  display: grid;
  grid-template-columns: 350px 1fr;
  gap: 32px;
}

// 主题选择器
.subject-selector {
  background: white;
  .border-radius();
  padding: 24px;
  .shadow();

  h2 {
    margin-bottom: 20px;
    color: @text-primary;
  }
}

// 学段选择器
.level-selector {
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid @border-light;

  h3 {
    font-size: 1rem;
    margin-bottom: 12px;
    color: #555;
  }

  .level-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
  }

  .level-btn {
    padding: 8px 16px;
    border: 1px solid @border-color;
    border-radius: @border-radius-lg;
    background: white;
    color: @text-secondary;
    cursor: pointer;
    .transition();

    &:hover {
      border-color: @primary-color;
      color: @primary-color;
    }

    &.active {
      background: @primary-color;
      border-color: @primary-color;
      color: white;
    }
  }
}

// 加载状态
.loading {
  text-align: center;
  padding: 40px 20px;
  color: @text-secondary;

  .loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid @primary-color;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 16px;
  }
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

// 无主题提示
.no-subjects {
  text-align: center;
  padding: 40px 20px;
  color: @text-secondary;
  font-style: italic;
}

// 主题列表
.subject-list {
  .flex-column();
  gap: 12px;
}

.subject-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  .border-radius(@border-radius-sm);
  cursor: pointer;
  .transition();
  border: 2px solid transparent;

  &:hover {
    background: @bg-light;
    border-color: @border-light;
  }

  &.active {
    background: @bg-blue-light;
    border-color: @primary-color;
  }

  .subject-icon {
    font-size: 2rem;
    width: 48px;
    text-align: center;
  }

  .subject-info {
    h3 {
      font-size: 1.1rem;
      margin-bottom: 4px;
      color: @text-primary;
    }

    p {
      font-size: 0.9rem;
      color: @text-secondary;
      line-height: 1.4;
      margin-bottom: 8px;
    }

    .subject-meta {
      display: flex;
      gap: 8px;
      align-items: center;

      .difficulty {
        padding: 2px 8px;
        border-radius: 12px;
        font-size: 0.75rem;
        font-weight: 500;

        &.easy {
          background: #e8f5e8;
          color: #2e7d32;
        }

        &.medium {
          background: #fff3e0;
          color: #f57c00;
        }

        &.hard {
          background: #ffebee;
          color: #c62828;
        }
      }

      .time {
        font-size: 0.75rem;
        color: @text-light;
        background: #f5f5f5;
        padding: 2px 6px;
        .border-radius(@border-radius-sm);
      }
    }
  }
}

// 学习区域
.learning-area {
  background: white;
  .border-radius();
  padding: 32px;
  .shadow();

  .subject-content {
    h2 {
      margin-bottom: 16px;
      color: @text-primary;
    }

    p {
      margin-bottom: 32px;
      color: @text-secondary;
      line-height: 1.6;
    }
  }
}

// 可视化占位符
.visualization-placeholder {
  border: 2px dashed @border-color;
  .border-radius();
  padding: 60px 20px;
  text-align: center;
  background: @bg-light;

  .placeholder-content {
    max-width: 400px;
    margin: 0 auto;

    .placeholder-icon {
      font-size: 4rem;
      margin-bottom: 20px;
    }

    h3 {
      margin-bottom: 12px;
      color: @text-primary;
    }

    p {
      margin-bottom: 24px;
      color: @text-secondary;
    }
  }
}

// 欢迎内容
.welcome-content {
  .flex-center();
  height: 100%;

  .welcome-card {
    text-align: center;
    max-width: 400px;

    .welcome-icon {
      font-size: 4rem;
      margin-bottom: 20px;
    }

    h2 {
      margin-bottom: 16px;
      color: @text-primary;
    }

    p {
      color: @text-secondary;
      line-height: 1.6;
    }
  }
}

// 按钮样式
.btn {
  padding: 12px 24px;
  border: none;
  .border-radius(@border-radius-sm);
  font-weight: 600;
  cursor: pointer;
  .transition();

  &.btn-primary {
    background: @success-color;
    color: white;

    &:hover {
      background: @success-hover;
      transform: translateY(-2px);
    }
  }

  &.btn-secondary {
    background: #e0e0e0;
    color: @text-primary;
    margin-left: 10px;

    &:hover {
      background: #d0d0d0;
      transform: translateY(-2px);
    }
  }
}

// 功能列表
.feature-list {
  list-style: none;
  padding: 0;
  margin-top: 20px;
  text-align: left;

  li {
    margin-bottom: 8px;
    color: #555;
    font-size: 0.9rem;
    position: relative;
    padding-left: 20px;

    &::before {
      content: '✓';
      position: absolute;
      left: 0;
      color: #67c23a;
      font-weight: bold;
    }
  }
}

// 对话框底部
.dialog-footer {
  display: flex;
  justify-content: center;
}

// 学习模式样式
.learning-visualization {
  background: white;
  .border-radius();
  padding: 20px;
  .shadow();
  height: calc(100vh - 200px);
  overflow: hidden;

  .back-to-selection {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid @border-light;

    .back-btn {
      background: none;
      border: none;
      color: @text-secondary;
      cursor: pointer;
      padding: 8px 16px;
      .border-radius(6px);
      .transition(all, 0.2s);
      font-size: 1rem;
      margin-right: 16px;

      &:hover {
        background: @bg-light;
        color: @text-primary;
      }
    }

    h2 {
      margin: 0;
      color: #2c3e50;
      font-size: 1.5rem;
    }
  }

  .visualization-content {
    height: calc(100% - 80px);
    overflow-y: auto;
  }
}

// 主题占位符
.subject-placeholder {
  text-align: center;
  padding: 60px 20px;
  color: @text-secondary;

  .placeholder-icon {
    font-size: 4rem;
    margin-bottom: 20px;
  }

  h3 {
    color: #2c3e50;
    margin-bottom: 12px;
  }

  p {
    color: #7f8c8d;
    font-style: italic;
  }
}

// 响应式设计
@media (max-width: 768px) {
  .learning-content {
    grid-template-columns: 1fr;

    .subject-selector {
      order: 2;
    }

    .learning-area {
      order: 1;
    }
  }

  .learning-visualization {
    height: calc(100vh - 150px);
    margin: 0 -10px;
    .border-radius(8px);

    .back-to-selection {
      flex-direction: column;
      align-items: flex-start;
      gap: 10px;

      .back-btn {
        margin-right: 0;
      }
    }
  }
}
